﻿<Window x:Class="RainwaterTankEstimator.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:chart="clr-namespace:De.TorstenMandelkow.MetroChart;assembly=De.TorstenMandelkow.MetroChart"
        Title="Rainwater Simulation Utility" Height="525" Width="500" WindowState="Maximized" Background="WhiteSmoke">
    <Window.Resources>
        <Style x:Key="MinimalChartStyle" TargetType="chart:ChartBase">
            <Setter Property="Width" Value="400"/>
            <Setter Property="Height" Value="350"/>
            <Setter Property="Background" Value="WhiteSmoke"/>
        </Style>

        <Style x:Key="SmallChartStyle" TargetType="chart:ChartBase">
            <Setter Property="Width" Value="1100"/>
            <Setter Property="Height" Value="350"/>
            <Setter Property="Background" Value="WhiteSmoke"/>
        </Style>
    </Window.Resources>

    <StackPanel>
        <StackPanel Name="InputPanel" Orientation="Horizontal">
            <!--User input area-->
            <StackPanel>
                <!--Text header-->
                <TextBlock Text="System specifications" Foreground="DarkSlateGray" FontSize="24" FontWeight="Light" Margin="20, 10, 0, 0"/>

                <!--Roof area input-->
                <StackPanel Orientation="Horizontal" Margin="20, 7.5, 0, 0">
                    <TextBlock Text="Roof area: "/>
                    <TextBox Width="50" Text="{Binding Path=RoofArea, Mode=TwoWay}"/>
                    <TextBlock Text=" m²"/>
                </StackPanel>

                <!--Tank capacity input-->
                <StackPanel Orientation="Horizontal" Margin="20, 5, 0, 0">
                    <TextBlock Text="Tank capacity: "/>
                    <TextBox Width="50" Text="{Binding Path=TankSize, Mode=TwoWay}"/>
                    <TextBlock Text=" gallons"/>
                </StackPanel>

                <!--Water use input-->
                <StackPanel Orientation="Horizontal" Margin="20, 5, 0, 0">
                    <TextBlock Text="Water use per day: "/>
                    <TextBox Width="50" Text="{Binding Path=WaterUse, Mode=TwoWay}"/>
                    <TextBlock Text=" liters"/>
                </StackPanel>
            </StackPanel>
            
            <StackPanel Margin="170, 0, 0, 0">
                <!--Text header-->
                <TextBlock Text="Advanced" Foreground="DarkSlateGray" FontSize="24" FontWeight="Light" Margin="20, 10, 0, 0"/>

                <!--Efficiency input-->
                <StackPanel Orientation="Horizontal" Margin="20, 7.5, 0, 0">
                    <TextBlock Text="System efficiency: "/>
                    <TextBox Width="50" Text="{Binding Path=Efficiency, Mode=TwoWay}"/>
                    <TextBlock Text=" %"/>
                    <TextBlock Text=" - rainwater retained rather than leaked or lost" Foreground="Gray" FontWeight="Light"/>
                </StackPanel>

                <!--First flush input-->
                <StackPanel Orientation="Horizontal" Margin="20, 5, 0, 0">
                    <TextBlock Text="First flush capacity: "/>
                    <TextBox Width="50" Text="{Binding Path=FirstFlush, Mode=TwoWay}"/>
                    <TextBlock Text=" mm"/>
                    <TextBlock Text=" - rainwater absorbed by first flush" Foreground="Gray" FontWeight="Light"/>
                </StackPanel>
            </StackPanel>

            <Button Content="Visualize" Margin="100, -50, 0, 0" Height="25" Width="60" Click="VisualizeClick"/>
            <TextBlock Name="ErrorBox" Margin="10, 24, 0, 0"/>
        </StackPanel>

        <!--Display visuals-->
        <StackPanel Orientation="Horizontal">
            <chart:DoughnutChart
                Name="SecondChart"
                Style="{StaticResource MinimalChartStyle}"
                ChartTitle="Overall demand met"
                ChartSubTitle="Number of days with sufficient/insufficent water"
                SelectedItem="{Binding Path=SelectedItem, Mode=TwoWay}" >
                <chart:DoughnutChart.Series>
                    <chart:ChartSeries
                    SeriesTitle="Data"
                    DisplayMember="Category"
                    ValueMember="Number"
                    ItemsSource="{Binding Path=Data}" />
                </chart:DoughnutChart.Series>
            </chart:DoughnutChart>
            
            <chart:StackedColumn100Chart
                Name="DemandChartMonthly"
                Style="{StaticResource SmallChartStyle}"
                ChartTitle="Demand met by month"
                ChartSubTitle="Number of days with sufficient/insufficent water for each month (normalized)"
                SelectedItem="{Binding Path=SelectedItem, Mode=TwoWay}" >
                <chart:StackedColumn100Chart.Series>
                    <chart:ChartSeries
                    SeriesTitle="Jan"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Jan2}" />
                    <chart:ChartSeries
                    SeriesTitle="Feb"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Feb2}" />
                    <chart:ChartSeries
                    SeriesTitle="Mar"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Mar2}" />
                    <chart:ChartSeries
                    SeriesTitle="Apr"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Apr2}" />
                    <chart:ChartSeries
                    SeriesTitle="May"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=May2}" />
                    <chart:ChartSeries
                    SeriesTitle="Jun"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Jun2}" />
                    <chart:ChartSeries
                    SeriesTitle="Jul"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Jul2}" />
                    <chart:ChartSeries
                    SeriesTitle="Aug"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Aug2}" />
                    <chart:ChartSeries
                    SeriesTitle="Sep"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Sep2}" />
                    <chart:ChartSeries
                    SeriesTitle="Oct"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Oct2}" />
                    <chart:ChartSeries
                    SeriesTitle="Nov"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Nov2}" />
                    <chart:ChartSeries
                    SeriesTitle="Dec"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Dec2}" />
                </chart:StackedColumn100Chart.Series>
            </chart:StackedColumn100Chart>
        </StackPanel>
        
        <StackPanel Orientation="Horizontal">
            <chart:DoughnutChart
                Name="MainChart"
                Style="{StaticResource MinimalChartStyle}"
                ChartTitle="Utilization summary"
                ChartSubTitle="Distribution of rainwater over the whole time period"
                SelectedItem="{Binding Path=SelectedItem, Mode=TwoWay}" >
                <chart:DoughnutChart.Series>
                    <chart:ChartSeries
                    SeriesTitle="Data"
                    DisplayMember="Category"
                    ValueMember="Number"
                    ItemsSource="{Binding Path=Data}" />
                </chart:DoughnutChart.Series>
            </chart:DoughnutChart>

            <chart:StackedColumnChart
                Name="MonthChart"
                Style="{StaticResource SmallChartStyle}"
                Margin="5, 0, 0, 0"
                ChartTitle="Monthly utilization"
                ChartSubTitle="Average distribution of rainwater by month"
                SelectedItem="{Binding Path=SelectedItem, Mode=TwoWay}" >
                <chart:StackedColumnChart.Series>
                    <chart:ChartSeries
                    SeriesTitle="Jan"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Jan}" />
                    <chart:ChartSeries
                    SeriesTitle="Feb"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Feb}" />
                    <chart:ChartSeries
                    SeriesTitle="Mar"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Mar}" />
                    <chart:ChartSeries
                    SeriesTitle="Apr"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Apr}" />
                    <chart:ChartSeries
                    SeriesTitle="May"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=May}" />
                    <chart:ChartSeries
                    SeriesTitle="Jun"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Jun}" />
                    <chart:ChartSeries
                    SeriesTitle="Jul"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Jul}" />
                    <chart:ChartSeries
                    SeriesTitle="Aug"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Aug}" />
                    <chart:ChartSeries
                    SeriesTitle="Sep"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Sep}" />
                    <chart:ChartSeries
                    SeriesTitle="Oct"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Oct}" />
                    <chart:ChartSeries
                    SeriesTitle="Nov"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Nov}" />
                    <chart:ChartSeries
                    SeriesTitle="Dec"
                    DisplayMember="Name"
                    ValueMember="Value"
                    ItemsSource="{Binding Path=Dec}" />
                </chart:StackedColumnChart.Series>
            </chart:StackedColumnChart>
        </StackPanel>
    </StackPanel>
</Window>
